package com.yangyang.utils;

import cn.hutool.core.lang.Singleton;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;

public class SnowUtil {

    public static  Long getSonwId(){
       //  可能重复
       Snowflake snowflake = IdUtil.getSnowflake(31, 31);
        Long id = snowflake.nextId();
        //此种方式可能重复的几率几乎为0
     /*   Snowflake snowflake = Singleton.get(Snowflake.class, 1, 1, true);
        Long id = snowflake.nextId();*/
        return  id;
    }
}
